package com.gitee.cashzhang27.test.boot.resilience4j;

import static org.springframework.web.reactive.function.server.RequestPredicates.GET;
import static org.springframework.web.reactive.function.server.RouterFunctions.route;
import static org.springframework.web.reactive.function.server.ServerResponse.permanentRedirect;

import java.net.URI;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.web.reactive.function.server.RouterFunction;
import org.springframework.web.reactive.function.server.ServerResponse;
/**
 * @author Cash Zhang
 * @version v1.0
 * @since 2019/11/26 16:08
 */
@SpringBootApplication
public class BootResilience4jApplication {

  public static void main(String[] args) {
    SpringApplication.run(BootResilience4jApplication.class, args);
  }

  @Bean
  RouterFunction<ServerResponse> redirectRoot() {
    return route(GET("/"), req -> permanentRedirect(URI.create("/actuator")).build());
  }
}
